package com.xtaller.sdboot.core.helper;

import org.springframework.context.ApplicationContext;

/**
 * @author : Taller
 * @date : 2020/2/6 13:35
 * @Description :
 */
public class SpringBeanHelper {
    private static ApplicationContext applicationContext;

    public static ApplicationContext getApplicationContext(){
        return applicationContext;
    }

    public static void setApplicationContext(ApplicationContext applicationContext){
        SpringBeanHelper.applicationContext = applicationContext;
    }

    public static <T> T getBean(String name){
        return (T)applicationContext.getBean(name);
    }

    public static <T> T getBean(Class<T> clazz){
        return applicationContext.getBean(clazz);
    }
}
